
<template>
  <FCModal
    :title="'影像审核'"
    :visible="visible"
    @cancel="cancel"
  >
    <FCForm
      v-bind="queryForm"
      :dataset="dateset"
    ></FCForm>
    <span style="color: red; font-weight: bold">柜面领款转主动支付退票不退回业务系统！</span>
    <div slot="footer">
      <FCButton
        type="primary"
        @click="look"
      >影像浏览</FCButton>
      <FCButton
        type="primary"
        @click="audit"
        :loading="loading"
      >审核</FCButton>
      <FCButton @click="cancel">取消</FCButton>
    </div>
  </FCModal>
</template>
<script>
import FCForm from '@/vendors/fc-ui/src/form/FCForm.vue'
import FCTable from '@/vendors/fc-ui/src/table/FCTable.vue'
import FCDataset from '@/vendors/fc-dataset/FCDataset'
import FCModal from '@/vendors/fc-ui/src/controls/FCModal'
import FCButton from '@/vendors/fc-ui/src/controls/FCButton'
import { imageAudit } from '@/apis/centralizedPaymentApi'
export default {
  name: 'modalLink',
  components: {
    FCForm,
    FCTable,
    FCModal,
    FCButton,
  },
  props: {
    visible: Boolean,
    currentRecord: Object,
  },
  data() {
    const dateset = new FCDataset({
      fields: [
        { name: 'checkcode', type: 'string' },
        { name: 'claimno', type: 'string' },
        { name: 'policyno', type: 'string' },
        { name: 'endorseno', type: 'string' },
        { name: 'checkstatus', type: 'string' },
        { name: 'summaryno', type: 'string' },
        { name: 'checkcontent', type: 'string' },
      ],
      datas: [],
    })
    return {
      dateset,
      queryForm: {
        cols: 2,
        fields: [
          {
            name: 'checkcode',
            title: '审核人员',
            controlType: 'input',
          },
          {
            name: 'claimno',
            title: '赔案号',
            controlType: 'input',
          },
          {
            name: 'policyno',
            title: '保单号',
            controlType: 'input',
          },
          {
            name: 'endorseno',
            title: '批单号',
            controlType: 'input',
          },
          {
            name: 'checkstatus',
            title: '审核状态',
            controlType: 'input',
          },
          {
            name: 'summaryno',
            title: '清单号',
            controlType: 'input',
          },
          {
            name: 'checkcontent',
            title: '审核意见',
            span: 24,
            labelCol: 4,
            wrapperCol: 20,
            controlType: 'textArea',
          },
        ],
      },
      resultData: [],
      index: null,
      record: null,
      loading: false,
    }
  },
  watch: {
    currentRecord: {
      handler(newValue) {
        this.dateset.addRecord(newValue)
      },
      deep: true,
    },
  },
  methods: {
    look() {
      window.open()
    },
    async audit() {
      this.loading = true
      const result = await imageAudit()
      this.loading = false
      if (result) {
        this.$message.success('审核成功！')
        this.close()
      } else {
        this.$message.warning('审核失败！')
      }
    },
    cancel() {
      this.close()
    },
    close() {
      this.dateset.clear()
      this.$emit('close')
    },
  },
}
</script>

<style lang="less" scoped></style>
